<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>GetSoundPosition</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">GetSoundPosition()</font></b></p>
<p><b>语法</b></p><blockquote>

Result = <font color="#3A3966"><b>GetSoundPosition</b></font>(#Sound [, Mode [, Channel]])</blockquote>

</blockquote>
<b>概要</b><br><blockquote>



Get the current sound position. 

 

</blockquote><p><b>参数</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#Sound</i></td>
<td width="90%"> 
 
The sound to use. 

 

</td></tr>
<tr><td><i>模式 （可选）</i></td>
<td> 
The mode used to get the position. 它可以是以下值之一︰ 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#PB_Sound_Frame</font>      : the position is returned in frame (default).
  <font color="#924B72">#PB_Sound_Millisecond</font>: the position is returned in milliseconds.
</font></pre>

</td></tr>
<tr><td><i>Channel (optional)</i></td>
<td> 
 
The channel to get the position. It's the value returned by <a href="playsound.html">PlaySound()</a> when using the 
<font color="#924B72">#PB_Sound_MultiChannel</font> flag. 

 

</td></tr>
</table>
</blockquote><p><b>返回值</b></p><blockquote>



The current sound position or -1 if an error occurred. 

 

</blockquote><p><b>备注</b></p><blockquote>



Sounds loaded with the <font color="#924B72">#PB_Sound_Streaming</font> flag are not supported. 

 

</blockquote><p><b>示例</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2"><font color="#3A3966"> InitSound</font>()           <font color="#3A3966">; Initialize Sound system</font>
<font color="#3A3966"> UseOGGSoundDecoder</font>()  <font color="#3A3966">; Use ogg files</font>

 <font color="#3A3966">; Loads 2 sounds</font>
<font color="#3A3966"> LoadSound</font>(0, <font color="#924B72">#PB_Compiler_Home</font> +"Examples\3D\Data\Siren.ogg")
<font color="#3A3966"> LoadSound</font>(1, <font color="#924B72">#PB_Compiler_Home</font> +"Examples\3D\Data\Roar.ogg")
 
 <font color="#3A3966">; The siren is playing </font>
<font color="#3A3966"> PlaySound</font>(0)
 
 <font color="#3A3966">; Display the position</font>
  <b><font color="#3A3966">Repeat</font></b>
   Pos=<font color="#3A3966">GetSoundPosition</font>(0, <font color="#924B72">#PB_Sound_Millisecond</font>)
<font color="#3A3966">   Delay</font>(100)   <font color="#3A3966">; Wait 100 ms</font>
   <b><font color="#3A3966">Debug</font></b> Pos    <font color="#3A3966">; Display the position</font>
   <b><font color="#3A3966">If</font></b> Pos&gt;1000  <font color="#3A3966">; Stop after 1 second</font>
     <b><font color="#3A3966">Break</font></b>
   <b><font color="#3A3966">EndIf</font></b>
  <b><font color="#3A3966">ForEver</font></b>
 
 <font color="#3A3966">; Then 2 sounds are playing together</font>
<font color="#3A3966">   PlaySound</font>(1)

<font color="#3A3966"> MessageRequester</font>("Info", "Ok to stop.")
 <b><font color="#3A3966">End</font></b> 
</font></pre>

</blockquote><p><b>参阅</b></p><blockquote>

<a href="setsoundposition.html">SetSoundPosition()</a> 

</Blockquote><p><b>已支持操作系统 </b><Blockquote>所有</Blockquote></p><center>&lt;- <a href=getsoundfrequency.html>GetSoundFrequency()</a> - <a href="index.html">Sound Index</a> - <a href="initsound.html">InitSound()</a> -&gt;<br><br>

</body></html>